package com.chaos.auth.config.userdetails;

import com.chaos.auth.config.userdetails.base.UserDetailsExtService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserByWxOpenIdDetailsService implements UserDetailsExtService {

//    @Resource
//    private UserFeign userFeign;

//    @Override
//    public UserDetails loadUserByWxOpenId(String wxOpenId, Long tenantId) throws WxOpenIdNotFoundException {
//        UserDto queryData = UserDto.builder().wxOpenId(wxOpenId).build();
//        queryData.setTenantId(tenantId);
//        List<TUserData> userInfoDatas = userService.selectByData(queryData);
//        TUserData userData = null;
//        if (ObjectUtil.isEmpty(userInfoDatas)) {
//            //userInfoData = (TUserData) register(registerDto);
//        } else {
//            userData = userInfoDatas.get(0);
//        }
//
//        UserUserDetails userDetails = new UserUserDetails(userData);
//        if (!userDetails.isEnabled()) {
//            throw new DisabledException("该账户已被禁用!");
//        }
//        userDetails.setAuthenticationIdentity(AuthenticationIdentityEnums.LogInIdentity.USER_WXOPENID.getCode());
//        return userDetails;
//    }


}
